<?php
include 'util/bloqueDeSeguridad.php';
include_once('datos/ClienteTarjetaDAL.php');

$dao = new ClienteTarjetaDAL();
//
$lista = $dao->obtenerClienteTarjeta();
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <title>Cliente</title>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <script src="Content/Scripts/jquery-1.7.2.js" type="text/javascript"></script>
    <script src="Content/Scripts/jquery-ui-1.8.20.custom.min.js" type="text/javascript"></script>
    <script src="Content/Scripts/jquery.ui.multiselect-4.3.3.js" type="text/javascript"></script>
    <script src="Content/Scripts/jquery.jqGrid.locale-en-4.1.2.js" type="text/javascript"></script>
    <script src="Content/Scripts/jquery.jqGrid-4.3.3.min.js" type="text/javascript"></script>
    <script src="Content/Scripts/jquery.droppy.js" type="text/javascript"></script>
    <script src="Content/Scripts/jquery.validate.min.js" type="text/javascript"></script>
    <script src="Content/Scripts/jquery.validate.unobtrusive.min.js" type="text/javascript"></script>
    <link href="Content/Site.css" rel="stylesheet" type="text/css" />
    <link href="Content/themes/redmond/jquery-ui-1.8.20.custom.css" rel="stylesheet" type="text/css" />
    <link href="Content/jqGrid/jquery-ui-jqgrid.css" rel="stylesheet" type="text/css" /> 
    <script type="text/javascript">
        //<![CDATA[
        /*global $ */
        /*jslint browser: true, unparam: true */
        $(function () {
                    
        $grid = $("#gridTemp"),
        
        initDateEdit = function (elem) {
            setTimeout(function () {
            $(elem).datepicker({
            dateFormat: 'dd-M-yy',
            autoSize: true,
            changeYear: true,
            changeMonth: true,
            showButtonPanel: true,
            showWeek: true
            });
            }, 100);
        },
                
        initDateSearch = function (elem) {
            setTimeout(function () {
            $(elem).datepicker({
            dateFormat: 'dd-M-yy',
            autoSize: true,
            changeYear: true,
            changeMonth: true,
            showWeek: true,
            showButtonPanel: true
            });
            }, 100);
        },  
         numberTemplate = {formatter: 'number', align: 'right', sorttype: 'number',
            searchoptions: { sopt: ['eq', 'ne', 'lt', 'le', 'gt', 'ge', 'nu', 'nn', 'in', 'ni'] }}, 

        dateTemplate = {width: 80, align: 'center', sorttype: 'date', formatter: 'date', 
        formatoptions: { newformat: 'd-M-Y' }, datefmt: 'd-M-Y', editoptions: { dataInit: initDateEdit }, 
        searchoptions: { sopt: ['eq', 'ne', 'lt', 'le', 'gt', 'ge'], dataInit: initDateSearch }},
    
        yesNoTemplate = {align: 'center', formatter: 'checkbox',
        edittype: 'checkbox', editoptions: {value: 'Yes:No', defaultValue: 'Yes'},
        stype: 'select', searchoptions: { sopt: ['eq', 'ne'], value: ':Any;true:Yes;false:No' }};
        
        $grid.jqGrid({
                    url: 'ClienteTarjetaBLL.php',
                    datatype: "xml",
                    mtype: "GET",
                    colNames: ['Nombre Apellido','Numero de Tarjeta','Codigo de Verificacion','Vencimiento de Tarjeta','Activo','Borrado'],
                    colModel: [
                        {name: 'nomapel', index: 'nomapel', width: 200, search: false},
                        {name: 'NumeroTarjeta', index: 'NumeroTarjeta', width: 200, search: false},
                        {name: 'CodVerificacion', index: 'CodVerificacion', width: 200, search: false},
                        {name: 'VencimientoTarjeta', index: 'VencimientoTarjeta', width: 200, search: false},
                        {name: 'isActivo', index: 'isActivo', width: 200, template: yesNoTemplate, search: false},
                        {name: 'isBorrado', index: 'isBorrado', width: 200, template: yesNoTemplate, search: false}

 ],
            rowNum: 1,
            rowList: [5, 10, 20],
            pager: '#pager',
            gridview: true,
            rownumbers: true,
            autoencode: true,
            ignoreCase: true,
            sortname: 'Empresa',
            viewrecords: true,
            multiselect: false,
            sortorder: 'desc',
            shrinkToFit: false,
            height: '100%',
            width: '910'
        });
        
        $grid.jqGrid('navGrid', '#pager', {refreshstate: 'current', add: false, edit: false, del: true, search:true},
                    {},
                    {},
                    { url: '/DeleteAddress',
                    onclickSubmit: function (options, postdata) {
                    alert('in onclickSubmit: postdata=' + postdata);
                    return 'hello';
                    }},
                    {multipleSearch:true,closeAfterSearch: true, closeOnEscape: true});             
             
                
        $('#del_gridTemp').click(function () {
        alert('in click selarrrow=[' + $grid.jqGrid('getGridParam', 'selarrrow').join(', ') + ']');
                                });                    
                                
        });
       
        //]]>
    </script>    
</head>
    <body>
        <div class="page">
            <div id="header">
                <div id="content">
					<h1>Administraci&oacute;n Clientes</h1>
					<?php require_once('util/menues.php'); ?>
                <div id="logindisplay">
                    <?php if ($_SESSION["autenticado"] == "SI") : ?>
                        [<a href="util/logout.php">Cerrar sesion</a>]
                    <?php else : ?>
                        [<a href="logon.php">Inicia sesion</a>]
                    <?php endif; ?>  
                </div>
				</div>
            </div>
            <div id="main">   
                <h2>Administraci&oacute;n Cliente Tarjeta</h2>
                <div align="center">
                    <table id="gridTemp"><tr><td></td></tr></table>
                    <div id="pager"></div>
                </div>
            </div>
			<div id="pie">Olaz&aacute;bal 1483 (C1428DGF), Ciudad Aut&oacute;noma de Buenos Aires, Argentina - (54 11) 4896-4647/4648</div>
        </div>        
    </body>
</html>
